#ifndef _SPARC2USB_H_
#define _SPARC2USB_H_
/*******************************************************************************
 **  Name: sparc2usb.cpp                                                      **
 **  Description:                                                             **
 **                                                                           **
 **  CDDL: Open Source Initiative (OSI) Approved License                      **
 **                                                                           **
 **  Copyright (c) 2009-2010 Barry "Gian" James  <bjames@munixos.net>         **
 **  All rights reserved.                                                     **
 **                                                                           **
 **  The contents of this file are subject to the terms of the CDDL:          **
 **  Common Development and Distribution License (the "License").             **
 **  You may not use this file except in compliance with the License.         **
 **                                                                           **
 **  You can obtain a copy of the license at $PROJECT_ROOT/LICENSE            **
 **  or http://www.opensolaris.org/os/licensing.  This code is Open Source    **
 **  and you are free to use it within the confines of the license, even      **
 **  for your own closed-source commercial projects, as long as you follow    **
 **  the terms set forth in the CDDL.                                         **
 **                                                                           **
 **  When distributing Covered Code, include this CDDL HEADER in each         **
 **  file and include the License file at $PROJECT_ROOT/LICENSE.              **
 **  If applicable, add the following below this CDDL HEADER, with the        **
 **  fields enclosed by brackets "[]" replaced with your own identifying      **
 **  information: Portions Copyright [yyyy] [name of copyright owner]         **
 **                                                                           **
 ******************************************************************************/
#define sparc2usb_h_ID_ "$Id: //depot/atbios/trunk/atbios.h#3 $"

#include <avr/pgmspace.h>


// Commands from the system to the keyboard
#define SPARC_RESET		0x01
#define SPARC_BELL_ON	0x02
#define SPARC_BELL_OFF	0x03
#define SPARC_CLICK_ON	0x0A
#define SPARC_CLICK_OFF	0x0B
#define SPARC_LED		0x0E
#define SPARC_LAYOUT	0x0F

// Commands from the keyboard to the system
#define SPARC_IDLE		0x07F
#define SPARC_LAYOUT_ACK 0x0FE
#define SPARC_RESET_ACK	0x0FF

// The bell has a period of 480us
#define SPARC_BELL_PERIOD	480		// us

#define SPARC_CLICK_PERIOD	480		// us
#define SPARC_CLICK_TIME	5		// ms

// the SPARC_LED command is followed by a status byte
#define SPARC_LED_BIT_NUMLOCK	0x01
#define SPARC_LED_BIT_COMPOSE	0x02
#define SPARC_LED_BIT_SCROLL	0x04
#define SPARC_LED_BIT_CAPS		0x08

// Data for the layout command
#define CANADA_FRENCH		0b00000011
#define DENMARK				0b00000100
#define FRENCH_BELGIUM		0b00000010
#define GERMANY				0b00000101
#define ITALY				0b00000110
#define JAPAN				0b00100000
#define NETHERLANDS			0b00000111
#define NORWAY				0b00001000
#define PORTUGAL			0b00001001
#define SPAIN_LATIN_AMER	0b00001010
#define SWEDEN_FINLAND		0b00001011
#define SWISS_FRENCH		0b00001100
#define SWISS_GERMAN		0b00001101
#define UNITED_KINGDOM		0b00001110
#define UNITED_STATES		0b00000000



extern const char __attribute__((__progmem__)) SparcToUSB[][2];
extern const char __attribute__((__progmem__)) SelfTestPass[];
extern const char __attribute__((__progmem__)) SelfTestFail[];
extern const char __attribute__((__progmem__)) SelfTestKeypress[];
extern const char __attribute__((__progmem__)) ResetAck[];

#endif
